package main

import (
	"fmt"
	"regexp"
	"strings"
)

func main9() {
	text := "i am a student, i have to go to school everyday. but all the efforts is valuable."

	// 匹配单个英文单词
	reg := regexp.MustCompile(`\w+`)

	// 每获取到一个单词，自定义函数都将被调用一次
	result := reg.ReplaceAllStringFunc(text, func(matched string) string {
		return strings.ToUpper(matched[0:1]) + matched[1:]
	})

	fmt.Println(result)
}
